import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [{
      path: '/home',
      name: 'Home',
      component: () => import('@/views/home/index.vue'),
      children: [{
          path: '',
          name: 'Main',
          component: () => import('@/views/main/index.vue')
        },
        {
          path: 'category/:labelId',
          name: 'Category',
          component: () => import('@/views/main/index.vue')
        },
        {
          path: 'leave-message',
          name: 'LeaveMessage',
          component: () => import('@/views/leave-message/index.vue')
        },
        {
          path: 'about-me',
          name: 'AboutMe',
          component: () => import('@/views/about-me/index.vue')
        }, ,
        {
          path: 'article-subject/:articleId',
          name: 'ArtucleSubject',
          component: () => import('@/views/article-subject/index.vue')
        }
      ]
    },
    {
      path: '/register',
      name: 'Register',
      component: () => import('@/views/register/index.vue')
    },
    {
      path: '/login',
      name: 'Login',
      component: () => import('@/views/login/index.vue')
    },
    {
      path: '',
      name: 'Redirect',
      redirect: '/home'
    },
    {
      path: '*',
      name: 'Illeage',
      component: () => import('@/components/Error.vue')
    }
  ]
})
